﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
    private Literal[] literalArrayNew;
    private Literal[] literalArrayRecommended;
    protected void Page_Load(object sender, EventArgs e)
    {
        literalArrayRecommended = new Literal[] {Literal1,Literal2,Literal3,Literal4,Literal5,Literal6};
        literalArrayNew = new Literal[] {Literal7,Literal8,Literal9,Literal10,Literal11,Literal12};
        DB db = new DB();
        Hashtable recommendedTable = db.getRecommendedProductsImages();
        int i = 0;
        foreach (DictionaryEntry de in recommendedTable)
        {
            if(i >= literalArrayRecommended.Length)
                break;
            literalArrayRecommended[i++].Text = "<a href='/showProduct.aspx?id="+de.Key+"'><img src='../pimages/"+de.Value+"' width='175px' height='140px'></a>";
        }
        Hashtable newTable = db.getNewProductsImages();
        i = 0;
        foreach (DictionaryEntry de in newTable)
        {
            if(i >= literalArrayNew.Length)
                break;
            literalArrayNew[i++].Text = "<a href='/showProduct.aspx?id=" + de.Key + "'><img src='../pimages/" + de.Value + "' width='175px' height='140px'></a>";
        }

        //填充联系方式
        Contact contact = db.getContact(1);
        addressLabel.Text += contact.Address_cn;
        for (int j = 0; j < contact.PhoneNumber.Count; ++j)
        {
            phoneLabel.Text += contact.PhoneNumber[j] + "  ";
        }
        for (int j = 0; j < contact.Fax.Count; ++j)
        {
            faxLabel.Text += contact.Fax[j] + "  ";
        }
        emailLabel.Text += contact.Email;

    }
}
